/**
 * 
 */
package co.edu.udem.service.subject.detail;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import co.edu.udem.domain.SubjectDetail;
import co.edu.udem.service.GenericDTO;

/**
 * @since 29/07/2012
 */
public class SubjectDetailDTO extends GenericDTO {

	private String subjectDetailCode;

	private String subjectCode;

	private String subjectDate;

	private String subjectTime;

	private String placeCode;

	/*
	 * (non-Javadoc)
	 * 
	 * @see co.edu.udem.service.GenericDTO#writeValuesToStringBuilder(java.lang.
	 * StringBuilder)
	 */
	@Override
	public void writeValuesToStringBuilder(StringBuilder stringBuilder) {
		stringBuilder.append(this.getSubjectDetailCode() == null ? " NULL, "
				: appendValueFormat(this.getSubjectDetailCode(), true));
		stringBuilder.append(this.getSubjectCode() == null ? " NULL, "
				: appendValueFormat(this.getSubjectCode(), true));
		stringBuilder.append(this.getSubjectDate() == null ? " NULL, "
				: appendValueFormat(this.getSubjectDate().toString(), true));
		stringBuilder.append(this.getSubjectTime() == null ? " NULL, "
				: appendValueFormat(this.getSubjectTime(), true));
		stringBuilder.append(this.getPlaceCode() == null ? " NULL, "
				: appendValueFormat(this.getPlaceCode(), false));
	}

	public static List<GenericDTO> populateDTOList(
			List<SubjectDetail> subjectDetailList) {
		List<GenericDTO> subjectDTOList = new ArrayList<GenericDTO>();

		if (subjectDetailList != null && !subjectDetailList.isEmpty()) {
			SubjectDetailDTO subjectDetailDTO;
			for (SubjectDetail subjectDetail : subjectDetailList) {
				subjectDetailDTO = new SubjectDetailDTO();
				subjectDetailDTO.setPlaceCode(subjectDetail.getPlaceCode());
				subjectDetailDTO.setSubjectCode(subjectDetail.getSubjectCode());
				subjectDetailDTO.setSubjectDate(subjectDetail.getSubjectDate());
				subjectDetailDTO.setSubjectDetailCode(subjectDetail
						.getSubjectDetailCode());
				subjectDetailDTO.setSubjectTime(subjectDetail.getSubjectTime());
				subjectDTOList.add(subjectDetailDTO);
			}
		}
		return subjectDTOList;
	}

	/**
	 * @return the subjectDetailCode
	 */
	public String getSubjectDetailCode() {
		return subjectDetailCode;
	}

	/**
	 * @param subjectDetailCode
	 *            the subjectDetailCode to set
	 */
	public void setSubjectDetailCode(String subjectDetailCode) {
		this.subjectDetailCode = subjectDetailCode;
	}

	/**
	 * @return the subjectCode
	 */
	public String getSubjectCode() {
		return subjectCode;
	}

	/**
	 * @param subjectCode
	 *            the subjectCode to set
	 */
	public void setSubjectCode(String subjectCode) {
		this.subjectCode = subjectCode;
	}

	/**
	 * @return the subjectDate
	 */
	public String getSubjectDate() {
		return subjectDate;
	}

	/**
	 * @param subjectDate
	 *            the subjectDate to set
	 */
	public void setSubjectDate(String subjectDate) {
		this.subjectDate = subjectDate;
	}

	/**
	 * @return the subjectTime
	 */
	public String getSubjectTime() {
		return subjectTime;
	}

	/**
	 * @param subjectTime
	 *            the subjectTime to set
	 */
	public void setSubjectTime(String subjectTime) {
		this.subjectTime = subjectTime;
	}

	/**
	 * @return the placeCode
	 */
	public String getPlaceCode() {
		return placeCode;
	}

	/**
	 * @param placeCode
	 *            the placeCode to set
	 */
	public void setPlaceCode(String placeCode) {
		this.placeCode = placeCode;
	}

}
